package pers.wensheng.patterns.creator_pattern.builder_pattern.common_usage;

import pers.wensheng.patterns.creator_pattern.builder_pattern.common_usage.builder.Builder;
import pers.wensheng.patterns.creator_pattern.builder_pattern.common_usage.entity.Bike;

/**
 * 指挥者类
 */
public class Director {
    /**
     * 声名builder类型的变量
     */
    private Builder builder;

    /**
     * 有参构造
     * @param builder
     */
    public Director(Builder builder){
        this.builder = builder;
    }

    /**
     * 组装自行车
     * @return
     */
    public Bike construct(){
        builder.buildFrame();
        builder.buildSeat();
        return builder.createBike();
    }

}
